//
//  GUILayer.h
//  ColourAssault
//
//  Created by Cloner Team on 8/22/14.
//
//

#ifndef GUI_LAYER_H
#define GUI_LAYER_H

#include "AbstractLayer.h"

class GUILayer: public AbstractLayer {
    UG_PROPERTY_FULL(UGLayer*, menuLayer, MenuLayer);
    UG_PROPERTY_FULL(UGLayer*, gameLayer, GameLayer);
    UG_PROPERTY_FULL(MenuItemSprite*, buttonStore, ButtonStore);
    UG_PROPERTY_FULL(MenuItemSprite*, buttonRemoveAds, ButtonRemoveAds);
    UG_PROPERTY_FULL(MenuItemSprite*, buttonRate, ButtonRate);
    UG_PROPERTY_FULL(MenuItemToggle*,buttonMusic, ButtonMusic);
    UG_PROPERTY_FULL(MenuItemSprite*, buttonShare, ButtonShare);
    UG_PROPERTY_FULL(MenuItemSprite*, buttonFacebook, ButtonFacebook);
    UG_PROPERTY_FULL(MenuItemSprite*, buttonMedal, ButtonMedal);
    UG_PROPERTY_FULL(MenuItemSprite*, buttonRank, ButtonRank);
    //GameLayers
    UG_PROPERTY_FULL(__Array*, buttonArrays, ButtonArrays)
    
private:
    bool choice[4];
    GUIListener* guiListener;
    Face* logo;
    Face* circle;
    virtual void onEnter();
    virtual void onExit();
    
    void initialize();
    void createLayers();
    void createLayersContent();
    
    void onTouchesBegan(const std::vector<Touch*>& touches, Event* event);
    void onTouchesMoved(const std::vector<Touch*>& touches, Event* event);
    void onTouchesEnded(const std::vector<Touch*>& touches, Event* event);
    void touchesRegister();
    
    void onDisplayMenu(Ref* data);
    void onDisplayGame(Ref* data);
    void onDisplayResult(Ref* data);
    
    void onButtonClick(Ref* sender);
    void displayBaseOnGameState();
public:
    GUILayer();
    ~GUILayer();
    virtual void update(float dt);
    CREATE_FUNC(GUILayer);
};
#endif /* defined(__ColourAssault__GUILayer__) */
